﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utility.Model
{

    /// <summary>
    /// 当前登录用户
    /// </summary>
    [Serializable]
    public class UserSession
    {
        public UserSession()
        {
            this.UserRoles = new Dictionary<string, string>();
            this.UserOperate = new Dictionary<string, List<Sys_Operate>>();
            this.UserModule = new List<Sys_Module>();
        }
        public string Ip
        {
            get;
            set;
        }
        /// <summary>
        /// 登录人ID
        /// </summary>
        public string UserID { get; set; }
        /// <summary>
        /// 登录名
        /// </summary>
        public string Account { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 部门Code
        /// </summary>
        public string DepartmentCode { get; set; }
        /// <summary>
        /// 部门ID
        /// </summary>
        public string DepartmentID { get; set; }
        /// <summary>
        /// 部门名称
        /// </summary>
        public string DepartmentName { get; set; }
        /// <summary>
        /// 上级部门ID
        /// </summary>
        public string ParentOrgID { get; set; }
        /// <summary>
        /// 上级部门Code
        /// </summary>
        public string ParentOrgCode { get; set; }
        /// <summary>
        /// 上级部门名称
        /// </summary>
        public string ParentOrgName { get; set; }
        /// <summary>
        /// 用户角色
        /// </summary>
        public Dictionary<string, string> UserRoles { get; set; }
        /// <summary>
        /// 用户功能
        /// </summary>
        public Dictionary<string, List<Sys_Operate>> UserOperate { get; set; }
        /// <summary>
        /// 用户模块
        /// </summary>
        public List<Sys_Module> UserModule { get; set; }

        bool _admin = false;
        /// <summary>
        /// 是否管理员
        /// </summary>
        public bool IsAdmin
        {
            get { return _admin; }
            set { _admin = value; }
        }
    }
}
